home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / FALCON / ACC / DRIVERS.ACC / FIXRSH.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-10  |  4.5 KB  |  153 lines

  1. /* FIXRSH.C
  2.  *==========================================================================
  3.  * DATE: February 19, 1990
  4.  * DESCRIPTION: Resource RSH file fixup for CPXs
  5.  * 
  6.  * INCLUDE FILE: FIXRSH.H
  7.  */
  8.  
  9.  
  10. /* INCLUDE FILES
  11.  *==========================================================================
  12.  */
  13. #include <sys\gemskel.h>
  14.  
  15.  
  16. /* PROTOTYPES
  17.  *==========================================================================
  18.  */
  19. void fix_rsh( int num_obs, int num_frstr, int num_frimg, int num_tree,
  20.               OBJECT *rs_object, TEDINFO *rs_tedinfo, BYTE *rs_strings[],
  21.               ICONBLK *rs_iconblk, BITBLK *rs_bitblk, long *rs_frstr,
  22.               long *rs_frimg, long *rs_trindex, struct foobar *rs_imdope );
  23.  
  24.  
  25. /* EXTERNALS
  26.  *==========================================================================
  27.  */
  28.  
  29.  
  30. /* GLOBAL
  31.  *==========================================================================
  32.  */
  33.  
  34.  
  35. /* LOCAL
  36.  *==========================================================================
  37.  */
  38. struct foobar {
  39.     WORD    dummy;
  40.     WORD    *image;
  41.     };
  42.  
  43.  
  44.  
  45. /* FUNCTIONS
  46.  *==========================================================================
  47.  */
  48.  
  49. /* fix_rsh()
  50.  *==========================================================================
  51.  * Takes the resource rsh attributes and performs x,y fixups.
  52.  * In conjunction with Rsrc_obfix(), objects are adjusted according
  53.  * to 16 pixel high and 8 pixel wide characters.
  54.  * By using rsrc_obfix(), objects are adjusted according to the
  55.  * current workstation character height and width.
  56.  *
  57.  * IN:   ALL of the objects can be found in the RSH file.
  58.  *     Note that some might have renamed items in their RSH to avoid
  59.  *     duplicate symbols, therefore, before saving a new RSH file,
  60.  *     check if there are variables that have been renamed and take
  61.  *     note of them.
  62.  * OUT:  void
  63.  *
  64.  * GLOBAL: BOOLEAN Fix_As_Dialog:   TRUE - adjust old way based upon
  65.  *                    the current char height and width.
  66.  * This was necessary because some trees, such as our alert box and
  67.  * menus, (if we ever use them) must not be adjusted for
  68.  * 8x16 only.
  69.  */
  70. void
  71. fix_rsh( int num_obs, int num_frstr, int num_frimg, int num_tree,
  72.          OBJECT *rs_object, TEDINFO *rs_tedinfo, BYTE *rs_strings[],
  73.          ICONBLK *rs_iconblk, BITBLK *rs_bitblk, long *rs_frstr,
  74.          long *rs_frimg, long *rs_trindex, struct foobar *rs_imdope )
  75. {
  76.     int     i;
  77.     long    index;
  78.  
  79.     for( i = 0; i < num_obs; i++ ) {
  80.     index = rs_object[i].ob_spec.index;
  81.     switch( rs_object[i].ob_type ) {
  82.     /* ob_spec -> TEDINFO */
  83.     case G_TEXT:
  84.     case G_BOXTEXT:
  85.     case G_FTEXT:
  86.     case G_FBOXTEXT:
  87.         /* fix pointers in TEDINFO */
  88.         rs_tedinfo[index].te_ptext =
  89.         rs_strings[(long)(rs_tedinfo[index].te_ptext)];
  90.         rs_tedinfo[index].te_ptmplt =
  91.         rs_strings[(long)(rs_tedinfo[index].te_ptmplt)];
  92.         rs_tedinfo[index].te_pvalid =
  93.         rs_strings[(long)(rs_tedinfo[index].te_pvalid)];
  94.         /* fix ob_spec */
  95.         rs_object[i].ob_spec.tedinfo = &rs_tedinfo[index];
  96.         break;
  97.     /* ob_spec -> ICONBLK */
  98.     case G_ICON:
  99.         /* fix pointers in ICONBLK */
  100.         #pragma warn -sus
  101.         rs_iconblk[index].ib_pmask =
  102.         rs_imdope[(long)(rs_iconblk[index].ib_pmask)].image;
  103.         rs_iconblk[index].ib_pdata =
  104.         rs_imdope[(long)(rs_iconblk[index].ib_pdata)].image;
  105.         #pragma warn .sus
  106.         rs_iconblk[index].ib_ptext =
  107.         rs_strings[(long)(rs_iconblk[index].ib_ptext)];
  108.         rs_object[i].ob_spec.iconblk = &rs_iconblk[index];
  109.         break;
  110.     /* ob_spec -> BITBLK */
  111.     case G_IMAGE:
  112.         /* fix pointers in BITBLK */
  113.         #pragma warn -sus
  114.         rs_bitblk[index].bi_pdata =
  115.         rs_imdope[(long)(rs_bitblk[index].bi_pdata)].image;
  116.         #pragma warn .sus
  117.         rs_object[i].ob_spec.bitblk = &rs_bitblk[index];
  118.         break;
  119.     /* ob_spec -> string */
  120.     case G_BUTTON:
  121.     case G_STRING:
  122.     case G_TITLE:
  123.         rs_object[i].ob_spec.free_string = rs_strings[index];
  124.         break;
  125.     /* ob_specs not requiring fixups */
  126.     case G_USERDEF:
  127.     case G_BOX:
  128.     case G_IBOX:
  129.     case G_BOXCHAR:
  130.         break;
  131.     }
  132.     rsrc_obfix( rs_object, i );
  133.     }
  134.  
  135.     /* fix up free strings & images */
  136.     for( i = 0; i < num_frstr; i++ )
  137.     rs_frstr[i] = (long)(rs_strings[rs_frstr[i]]);
  138.     for( i = 0; i < num_frimg; i++ ) {
  139.     index = rs_frimg[i];
  140.     #pragma warn -sus
  141.     rs_bitblk[index].bi_pdata =
  142.         rs_imdope[(long)(rs_bitblk[index].bi_pdata)].image;
  143.     #pragma warn .sus
  144.     rs_frimg[i] = (long)(&rs_bitblk[rs_frimg[i]]);
  145.     }
  146.     /* fix up tree index references */
  147.     for( i = 0; i < num_tree; i++ )
  148.         rs_trindex[i] = (long)(&rs_object[rs_trindex[i]]);
  149. }
  150.  
  151.  
  152.  
  153.